Heuristic 1: Position Strategy
A standard Minimax AI only knows it has won when it forms 5-in-a-row. Until that very last moment, every spot on the board often looks "equal" (score 0), causing it to move randomly in the early game.
The Concept
- Not all empty spots are equal. A stone played in the corner is weak; it has fewer directions to expand.
- A stone in the center is powerful. It controls vertical, horizontal, and diagonal lines simultaneously.
- Goal: Encourage the AI to control the center even before it sees a winning line.
The Implementation: "Heatmaps"
Instead of calculating "centrality" geometry in real-time (which is slow), we pre-define a lookup table.
This is a 2D matrix matching the board size. Higher numbers indicate more valuable strategic positions. When evaluate_board runs, we simply look up the value for every stone the AI has placed.